package com.etc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class hellomain {
    public static void main(String[] args) {

        //加载spring上下
//        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
////        HelloWord helloSpring = (HelloWord) context.getBean("slkdfjo");//获取hj的bean
//        HelloWord helloSpring = context.getBean(HelloWord.class);
//        //另一种写法这样就不需要强制类型转换
//        System.out.println(helloSpring.toString());

//        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
//        HelloMap helloSpring = (HelloMap) context.getBean("hellomap");//获取hj的bean
////        HelloWord helloSpring = context.getBean(HelloWord.class);
//        //另一种写法这样就不需要强制类型转换
//        System.out.println(helloSpring.getIntegerMap().get("bookey"));
//


        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        B b = (B) context.getBean("bbb");//获取hj的bean
        //另一种写法这样就不需要强制类型转换
        b.eat();

    }
}
